Rotate Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Rotates a list and returns the rotated list, without changing the source list.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static IEnumerable<T> Rotate<T>(
	IList<T> source,
	int amountToRotate
)
Visual Basic (Declaration)
Public Shared Function Rotate(Of T) ( _
	source As IList(Of T), _
	amountToRotate As Integer _
) As IEnumerable(Of T)
Visual C++
public:
generic<typename T>
static IEnumerable<T>^ Rotate (
	IList<T>^ source, 
	int amountToRotate
)

Parameters

source
IList<(Of <T>)>
The list to rotate.
amountToRotate
Int32
The number of elements to rotate. This value can be positive or negative. For example, rotating by positive 3 means that source[3] is the first item in the returned collection. Rotating by negative 3 means that source[source.Count - 3] is the first item in the returned collection.

Return Value

A collection that contains the items from source in rotated order.

Type Parameters

T

Exceptions

ExceptionCondition
System..::ArgumentNullExceptionsource is null.

See Also